package com.mornd.gulimall.common.core.utils;

import java.time.LocalDateTime;
import java.time.ZoneOffset;

/**
 * @author: mornd
 * @dateTime: 2023/8/29 - 13:55
 */
public class LocalDateTimeUtil extends cn.hutool.core.date.LocalDateTimeUtil {

    /**
     * 转为时间戳，类似于Date的getTime()
     * @param dateTime
     * @return
     */
    public static long toEpochMilli(LocalDateTime dateTime) {
        return dateTime.toInstant(ZoneOffset.of("+8")).toEpochMilli();
    }

    /**
     * 获取当前时间戳
     * @return
     */
    public static long nowMilli() {
        return LocalDateTimeUtil.toEpochMilli(LocalDateTime.now());
    }
}
